﻿// -----------------------------------------------------------------------
// <copyright file="TextEditorForm.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.CommonForms
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// Text editor form
    /// </summary>
    public partial class TextEditorForm : Form
    {
        private bool canceled = true;

        /// <summary>
        /// Initializes a new instance of the TextEditorForm class.
        /// </summary>
        public TextEditorForm()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Sets the information text
        /// </summary>
        public string InfoText
        {
            set
            {
                this.lblInfo.Text = value;
            }
        }

        /// <summary>
        /// Gets the user text
        /// </summary>
        public string EditorText
        {
            get
            {
                return this.ValueTextBox.Text;
            }
            set
            {
                this.ValueTextBox.Text = value;
                this.ValueTextBox.SelectAll();
            }
        }

        public bool Canceled
        {
            get
            {
                return this.canceled;
            }
            set
            {
                this.canceled = value;
            }
        }

        /// <summary>
        /// Occurs when the user click ok
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void OkButton_Click(object sender, EventArgs e)
        {
            this.Close();
            this.Canceled = false;
        }
    }
}
